import { request } from 'umi';

// 获取商户门店列表
export async function getRestaurantList(params = {}) {
  return request(`${window.API_BASE_URL}/admin/restaurant/list`, {
    method: 'GET',
    params,
  });
}

// 创建商户门店
export async function createRestaurant(data) {
  return request(`${window.API_BASE_URL}/admin/restaurant`, {
    method: 'POST',
    data,
  });
}

// 获取商户门店区域列表
export async function getRestaurantAreas(params = {}) {
  return request(`${window.API_BASE_URL}/admin/restaurant/${window.MERCHANT_ID}/areas`, {
    method: 'GET',
    params,
  });
}

// 创建商户门店区域
export async function createRestaurantArea(data) {
  return request(`${window.API_BASE_URL}/admin/restaurant/${window.MERCHANT_ID}/areas`, {
    method: 'POST',
    data,
  });
}

// 获取商户门店桌位列表
export async function getRestaurantTables(params = {}) {
  return request(`${window.API_BASE_URL}/admin/restaurant/${window.MERCHANT_ID}/tables`, {
    method: 'GET',
    params,
  });
}

// 创建商户门店桌位
export async function createRestaurantTable(data) {
  return request(`${window.API_BASE_URL}/admin/restaurant/${window.MERCHANT_ID}/tables`, {
    method: 'POST',
    data,
  });
}

export async function updateRestaurantTable(id, data) {
  return request(`${window.API_BASE_URL}/admin/restaurant/tables/${id}`, {
    method: 'PUT',
    data,
  });
}

// 删除商户门店桌位
export async function deleteRestaurantTable(id) {
  return request(`${window.API_BASE_URL}/admin/restaurant/tables/${id}`, {
    method: 'DELETE',
  });
}

// 删除商户门店区域
export async function deleteRestaurantArea(id) {
  return request(`${window.API_BASE_URL}/admin/restaurant/areas/${id}`, {
    method: 'DELETE',
  });
}
